<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="assets/images/favicon.png" type="image/png">
    <title></title>
    <link href="assets/css/icons.css" rel="stylesheet">
    <link href="assets/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/responsive.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="js/html5shiv.min.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->


</head>

<body class="sticky-header">


<!--Start login Section-->
<section class="login-section">
    <div class="container">
        <div class="row">
            <div class="login-wrapper">
                <div class="login-inner">

                    <div class="logo">
                        <img src="assets/images/logo-dark.png"  alt="logo"/>
                    </div>
                    <div style="margin-bottom: 20px">
                        <h2 class="header-title text-center">登录</h2>
                    </div>

                    <form id="from_login">
                        <div class="form-group">
                            <input type="text" class="form-control" id="phone" placeholder="请输入11位数字的手机号" >
                        </div>

                        <div class="form-group">
                            <input type="text" placeholder="请输入短信验证码" id="code" name="sms_captcha" class="form-captcha" autocomplete="off">
                            <a href="javascript:void(0);" class="sms-captcha" onclick="sendcode()"title="发送验证码">获取短信验证码</a>
                        </div>


                        <div class="form-group">
                            <input type="button" value="登录" onclick="loginphone()"class="btn btn-primary btn-block" >
                        </div>

                        <div class="form-group text-center">
                            Don't have an account?  <a href="registration.html">注册 </a>
                            <a href="loginpass.html">||密码登录 </a>
                            <a href="index.html"> ||首页 </a>
                        </div>

                    </form>

                    <div class="copy-text">
                        <p class="m-0">2021 &copy; Meter admin</p>
                    </div>

                </div>
            </div>

        </div>
    </div>
</section>
<!--End login Section-->




<!--Begin core plugin -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src = "assets/js/util/http-util.js"></script>
<!-- End core plugin -->

</body>

</html>
<script>

    /*发送验证码请求*/
    function sendcode() {
        let url = "/loginphone";
        let phone =  $("#phone").val();
        if (phone==""){
            alert("手机号不能为空");
            return false;
        }
        let params ={phone : phone};
        doPost(url,params,function (json) {
            alert("获取验证码成功");
        });

    }





    function loginphone() {
        let url = "/login";
        let phone =  $("#phone").val();
        let code =  $("#code").val();
        if (phone==""){
            alert("手机号不能为空");
            return false;
        }
        if (code==""){
            alert("验证码不能为空");
            return false;
        }
        let params ={phone : phone, code : code};
        doPost(url,params,function (json) {
            location.href = "index.html";
            alert("登录成功");
        });

    }
</script>
